package com.flashmoment.video.controller;

import java.util.Arrays;
import java.util.Map;

import com.flashmoment.video.utils.PageUtils;
import com.flashmoment.video.utils.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.flashmoment.video.entity.UserTagEntity;
import com.flashmoment.video.service.UserTagService;

import org.springframework.web.bind.annotation.CrossOrigin;



/**
 * 标签表
 *
 * @author xulu
 * @email 1435533194@qq.com
 * @date 2023-10-24 16:35:33
 */
@RestController
@RequestMapping("video/usertag")
@CrossOrigin
@Api(tags = "用户标签接口")
public class UserTagController {
    @Autowired
    private UserTagService userTagService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userTagService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		UserTagEntity userTag = userTagService.getById(id);

        return R.ok().put("userTag", userTag);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody UserTagEntity userTag){
		userTagService.save(userTag);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserTagEntity userTag){
		userTagService.updateById(userTag);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		userTagService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
